package Controllers;

import DAO.Login_Dao;
import Models.Login;
import org.junit.After;
import org.junit.AfterClass;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class Login_ControllerTest_1 {

    public Login_ControllerTest_1() {
    }

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    @Test
    public void ValidateName() throws Exception {
        System.out.println("ValidateLogin");
        String Name = "a1";
        String Pass = "123";

        Login_Controller instance = new Login_Controller(new Login_Dao());
        Login result = instance.Validate(Name, Pass);
        assertEquals(Name, result.getName());

    }

    @Test
    public void ValidatePass() throws Exception {
        System.out.println("ValidateLogin");
        String Name = "a1";
        String Pass = "123";

        Login_Controller instance = new Login_Controller(new Login_Dao());
        Login result = instance.Validate(Name, Pass);
        assertEquals(Pass, result.getPass());

    }

    @Test
    public void ValidateEmpty() throws Exception {
        System.out.println("ValidateLogin");
        String Name = "Mixalis";
        String Pass = "";

        Login_Controller instance = new Login_Controller(new Login_Dao());
        Login result = instance.Validate(Name, Pass);

    }

    @Test//(expected = DaoException.class)
    public void ValidateEmpty2() throws Exception {
        System.out.println("ValidateLogin");
        String Name = "";
        String Pass = "2744";

        Login_Controller instance = new Login_Controller(new Login_Dao());
        Login result = instance.Validate(Name, Pass);

    }

}
